import { NavLink, useRoutes } from 'react-router-dom';
import Header  from './components/header'; 
import routes from './routes';

function App() {
    // useRoute(routesMapping) 使用路由表，自动生成路由代码
    const element = useRoutes(routes)
    return (
        <div id="root">
            <div>
                <div className="row">
                    <Header/> 
                </div>
                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">
                            <NavLink className="list-group-item" to="/about">
                                About
                            </NavLink>
                            <NavLink className="list-group-item" to="/home">
                                Home
                            </NavLink>
                        </div>
                    </div>
                    <div className="col-xs-6">
                        <div className="panel">
                            <div className="panel-body">
                                {element}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    );
}

export default App;
